import React, { Component } from 'react'
import Test from './Test'
const xxxRef = React.createRef()
export default class App extends Component {
  render() {
    return (
      <div>
        App
        <hr />
        <h1
          ref={(node) => {
            console.log(node)
          }}
        ></h1>
        {/* 注意: 如果在类组件上,写ref.则获取到的是组件的实例 */}
        <Test ref={xxxRef} a={1}></Test>
        <button
          onClick={() => {
            console.log((xxxRef.current.style.color = 'pink'))
          }}
        >
          按钮
        </button>
      </div>
    )
  }
}
